<include file="public/order_header"/>

<body>

<!--menu-->
<div class="meal-menu">
  <a href="javascript:;" class="active return-top" data-id="" > 全部 </a>
  <!--<a href="javascript:;">咖啡<i class="num">3</i></a>-->
  <volist name="category" id="category">
    <a href="#id_{$category.id}" data-id="{$category.id}" >{$category.name}<if condition="$category.count neq 0"><i class="num">{$category.count}</i></if></a>
  </volist>
</div>
<!--menu End--> 



<script>
    $(function () {
        $(window).scroll( function() {
            var scrollValue=$(window).scrollTop();
            scrollValue > 100 ? $('a[class=return-top]').fadeIn():$('a[class=return-top]').fadeOut();
        } );
        $('.return-top').click(function(){
            $("html,body").animate({scrollTop:0},200);
        });

        $(".meal-menu a").each(function(){
            $(this).click(function () {
                $(this).addClass('active').siblings('a').removeClass('active');
                var id = $(this).attr('data-id');
                $(".meal-menu a").removeClass('active');
                $("[data-id='" + id + "']").addClass('active');
            })
        });
    })
</script>

<!--产品列表-->
<div class="meal-row">

  <volist name="category2" id="category2">
    <div class="meal-rowItem" id="#id_{$category2.id}" >
      <h3 class="tit">{$category2.name}</h3>
      <ul class="list">

        <volist name="$category2.goods" id="goods">
          <li>
            <div class="pic fl">
              <img src="{$goods.original_img}">
            </div>
            <div class="word fr">
              <h3 class="t">{$goods.goods_name}</h3>
              <div class="c">
                {$goods.goods_remark}
              </div>
              <div class="f clearfix">
                <span class="price fl">￥<strong>{$goods.shop_price}</strong></span> <a href="javascript:;" class="gobuy fr" data-id="{$goods.goods_id}">+</a>
              </div>
            </div>
          </li>
        </volist>

      </ul>
    </div>

</volist>

</div>

<!--产品列表 End-->

<!--去结算-->
<div class="go-buySave clearfix">
  <a href="javascript:;" class="s-cartBtn fl">合计￥<strong id="total_price">{$total_price.total_fee}</strong>,订单(<span id="total_num">{$total_price.num}</span>)</a> <a href="{:U('payment/meal_order')}" class="s-settBtn fr">去结算</a>
</div>
<!--去结算 End-->

<!--footer-->
<include file="public/order_footer"/>
<!--footer End-->

<!--立即购买弹出层-->
<div class="pProduct-pupMarsk">
</div>
<div class="pProduct-pup" id="pProduct-pup">
  <a href="javascript:;" class="close iconfont" >&#xe6c5;</a>
  <div id="ajax_return"></div>
</div>
<!--立即购买弹出层 End-->
<script>
  $(function () {
      //立即购买
      $(".gobuy").click(function () {
          $(".pProduct-pupMarsk").show();
          $("#pProduct-pup").show();
          $('html').css({"overflow-y":"hidden"});
          var goods_id = $(this).attr('data-id');
          $.ajax({
              type : "POST",
              url:"/index.php?m=home&c=goods&a=order_detail",//+tab,
              data : {goods_id:goods_id},// 你的formid
              success: function(data){
                  $("#ajax_return").html('');
                  $("#ajax_return").append(data);
              }
          });

      });

      var is_show = "{$is_show}";
      if (is_show == 1){
          $(".pProduct-pupMarsk").show();
          $("#cart-pup").show();
          $('html').css({"overflow-y":"hidden"});
      }

  })
</script>



<!--购物车弹出层-->
<div class="pProduct-pupMarsk" >
</div>
<div class="pProduct-pup" id="cart-pup" >
  <a href="javascript:;" class="close iconfont">&#xe6c5;</a>
  <div class="cart-pupTit clearfix">
    <span class="cn fl">已选商品</span> <a href="javascript:;" class="qingk fr" onclick="empty_cart()" ><i class="iconfont">&#xe618;</i>清空购物车</a>
  </div>

  <div id="cart-list"></div>


  <div class="pProduct-pupButton">
    <a href="javascript:;" class="btn" onclick="close_cart()">确   定</a>
  </div>
</div>
<!--购物车弹出层 End-->

<script>
    CartList();

  function empty_cart(){
      layer.confirm('确认清空？', function () {
          $.ajax({
              type: 'post',
              url: '/home/cart/empty_cart.html',
              dataType: 'json',
              success: function (data) {
                  if (data.status == 200) {
                      layer.msg(data.msg,{icon:1,time:1000},function(){if(data.url){ window.location.href = data.url;}});
                  } else {
                      layer.msg(data.msg,{icon:2,time:2000},function(){if(data.url){ window.location.href = data.url;}});
                  }
              }
          })
      });
  }

  function close_cart(){
      $(".pProduct-pupMarsk").hide();
      $("#pProduct-pup").hide();
      $("#cart-pup").hide();
      $(".cancel-pup").hide();
      $('html').css({"overflow-y":"auto"});
  }
</script>

</body>
</html>
